#ifndef BSDIFFWIDGET_H
#define BSDIFFWIDGET_H

#include <QWidget>
#include <QFileDialog>
#include <QMessageBox>
#include <QFile>
#include <QButtonGroup>
#include <QPushButton>
#include <QLineEdit>

#include "../bsdiff/bsdiff.h"
#include "../bsdiff/bspatch.h"
#include "../minilzo-2.10/minilzo.h"

int bsdiffWrite(struct bsdiff_stream* stream, const void* buffer, int size);
int bsdiffRead(const struct bspatch_stream* stream, void* buffer, int length);
namespace Ui {
class bsdiffWidget;
}

class bsdiffWidget : public QWidget
{
    Q_OBJECT

public:
    explicit bsdiffWidget(QWidget *parent = nullptr);
    ~bsdiffWidget();

    quint32 outSize,inSize;
    struct bsdiff_stream bsdiffHandle;
    struct bspatch_stream bspatchHandle;

    quint8 * readEntireFile(QString _name,quint64 *_len);
    quint32 writeEntireFile(QString _name,quint8 *_buf,quint32 _len);
private slots:
    void bsdiff_GroupAddFile(QAbstractButton *button);
    void on_generatPushButton_clicked();

    void on_restorePushButton_clicked();

private:
    QButtonGroup        uFileGButton;
    QLineEdit           *lineEditFile[3];
    QPushButton         *pushButtonFile[3];

    Ui::bsdiffWidget *ui;
};

#endif // BSDIFFWIDGET_H
